<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>按钮</button>
    <h1></h1>
    <script>
        // 8.场景题：页面上有一个按钮，点击时在后面显示出一个由4位大写字母组成的随机字符串。（考点：Math方法、字符串下标、点击事件、文本内容操作）
        let q = "hellow"
        let w = q.toUpperCase()
        console.log(w);
        let btn = document.querySelector("button")
        let h1 = document.querySelector("h1")
        btn.addEventListener("click", function () {
            let m = w[Math.floor(Math.random() * (q.length - 0) + 0)]
            let n = w[Math.floor(Math.random() * (q.length - 0) + 0)]
            let v = w[Math.floor(Math.random() * (q.length - 0) + 0)]
            let z = w[Math.floor(Math.random() * (q.length - 0) + 0)]
            let c = w[Math.floor(Math.random() * (q.length - 0) + 0)]
            let k = w[Math.floor(Math.random() * (q.length - 0) + 0)]

            h1.innerHTML = `${m}${n}${v}${z}${c}${k}`
            
        })

    </script>
</body>

</html>